package com.cheng.im.service.conversation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cheng.im.service.conversation.domain.ImConversationSet;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
* @author Cheng
* @description 针对表【im_conversation_set】的数据库操作Mapper
* @createDate 2025-01-09 08:19:12
* @Entity generator.domain.ImConversationSet
*/
public interface ImConversationSetMapper extends BaseMapper<ImConversationSet> {

    @Select(" select max(sequence) from im_conversation_set where app_id = #{appId} AND from_id = #{userId} ")
    Long geConversationSetMaxSeq(String appId, String userId);

    @Update(" update im_conversation_set set readed_sequence = #{readedSequence},sequence = #{sequence} " +
            " where conversation_id = #{conversationId} and app_id = #{appId} AND readed_sequence < #{readedSequence}")
    void readMark(ImConversationSet imConversationSetEntity);
}




